package com._21cn.cms.yellow.service;

import com._21cn.cms.yellow.dao.YellowPageDao;
import com._21cn.cms.yellow.dao.YellowPagePictureDao;
import com._21cn.cms.yellow.entity.YellowPage;
import com._21cn.framework.base.db.BaseDao;
import com._21cn.framework.base.service.impl.BaseServiceImpl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("yellowPageService")
public class YellowPageService extends BaseServiceImpl<YellowPage>
{

    @Autowired
    private YellowPageDao yellowPageDao;

    @Autowired
    private YellowPagePictureDao yellowPagePictureDao;

    protected BaseDao<YellowPage> getBaseDao()
    {
        return this.yellowPageDao;
    }

    public YellowPage getById(Object id) {
        YellowPage yellowPage = (YellowPage)super.getById(id);
        if (yellowPage == null) {
            return null;
        }

        Map param = new HashMap();
        param.put("eqYellowPageId", id);
        param.put("orderByClause", "ORDER_NUM ASC");
        List yellowPagePictureList = this.yellowPagePictureDao.selectByMap(param, 1, 20, false);
        yellowPage.setYellowPagePictureList(yellowPagePictureList);

        return yellowPage;
    }
}